n table to evaluate the goodness of a discriminant model is the

ng to a confusion matrix.

Table 3.2. An example of a prediction table.

Raw class label (y)

Predicted class label (Z)

A

A

A

B

A

A

A

A

A

A

B

B

B

A

B

A

B

B

B

A

marising the predictions into different categories and compare the

ns against the desirable categories converts a prediction table

Table 3.2 to a confusion matrix shown in Table 3.3. In this table

n matrix), each entry is a summary statistic generated from a

n table shown in Table 3.2. For instance, Table 3.3 shows that

points of class A were correctly predicted and one data point of

was incorrectly predicted. Moreover, three data points of class B

ectly predicted and two data points of class B were misclassified.

Table 3.3: An example of a confusion matrix derived from Table 3.2.

Predicted A

Predicted B

%

true A

4

1

80

true B

2

3

60

%

67

75

70

R function for generating a confusion matrix is table. The

needs two inputs, i.e., a target or observation variable and a

n class variable. Both are binary variables as shown in Table 3.2.

the prediction variable as continuous model outputs is denoted by

ݕො) and a threshold is 0.5. This continuous vector is converted to

on class variable of binary values (Z) using the following code,